package Model;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseConfig{
	private String url = null;
	private String username = null;
	private String password = null;
	
	public DatabaseConfig()
	{
		url = "jdbc:sqlserver://localhost;databaseName=hire";
		username = "pycon";
		password = "pycon";
	}
	
	public Connection getConnection() throws SQLException, ClassNotFoundException
	{
		Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
		Connection connection = DriverManager.getConnection(url,username,password);//连接
		if(connection!=null)
		{	
			System.out.println("connect successfully");
			return connection;
		}
		else
		{	
			System.out.println("connect failed!");
			return null;
		}
	}
}